tree grammar MathFilterWalker;

options {
     language  = Java;
     tokenVocab = EquationGrammar;

     ASTLabelType = CommonTree;
     output=AST;
}
@header {
  package com.sri.ai.lpitools.latex.server;
}
converter
     : expression EOF ;

expression
   : ^('+' expression expression)
   | ^('-' expression expression)
   | ^('*' expression expression)
   | ^('/' a=. b=.)  ->  ^(MATH ^('/' $a $b))
   | ^('%' a=. b=.)  ->  ^(MATH ^('%' $a $b))
   | ^('^' a=. b=.)  ->  ^(MATH ^('^' $a $b))
   | IDENT 
   | FLOAT
   | INTEGER 
   | ^('|' a=. '|')  ->  ^(MATH ^('|' $a '|'))
   | ^('(' expression ')')
   | ^(FUNCTION IDENT expression)
   | ^('=' expression expression)
   | ^('!=' expression  expression)
   | ^('and' expression  expression)
   | ^( CONDITION expression expression expression )
   | ^( ATOMIC_RULE expression expression )
   ;